package com.study.langchain4j.api;

import dev.langchain4j.model.chat.ChatModel;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xl-9527
 * @since 2025/10/26
 **/
@RestController
@RequestMapping("ai/chat/base")
public class BaseHelloWorldChatApi {

    private final ChatModel chatModel;
    private final ChatModel chatModelDS;

    public BaseHelloWorldChatApi(@Qualifier("chatModel") final ChatModel chatModel, @Qualifier("chatModelDS") final ChatModel chatModelDS) {
        this.chatModel = chatModel;
        this.chatModelDS = chatModelDS;
    }

    @GetMapping("/hello")
    public String hello(@RequestParam("userMessage") String userMessage) {
        return chatModel.chat(
                userMessage
        );
    }

    @GetMapping("/hello/ds")
    public String helloHs(@RequestParam("userMessage") String userMessage) {
        return chatModelDS.chat(
                userMessage
        );
    }
}
